# Maintainer: David Runge <dvzrv@archlinux.org>

_name=micawber
pkgname=python-micawber
pkgver=0.5.5
pkgrel=1
pkgdesc="A small library for extracting rich content from urls"
arch=(any)
url="https://github.com/coleifer/micawber"
license=(MIT)
depends=(python)
makedepends=(
  python-build
  python-installer
  python-setuptools
  python-wheel
)
checkdepends=(
  python-pytest
  python-beautifulsoup4
  python-django
)
optdepends=(
  'python-beautifulsoup4: for text parser'
  'python-django: django support'
  'python-flask: flask support'
  'python-redis: redis caching support'
)
source=(https://files.pythonhosted.org/packages/source/${_name::1}/$_name/$_name-$pkgver.tar.gz)
sha512sums=('9fe25e346c37939c2fd45239b774d827bb5f8b32b8a1ca04c000fcd83a4a55f03cc09141ef863cfdcb2e7baf02018022c6163dabe7e4750412ced9f5f833917d')
b2sums=('25a17316988c529c1a85458744054aafc913fc724fcc57a207ac1b18d9c05f59015ae508ea22861706e014fe986cb5d31d25f9a7f22130fd21044292ff05e551')

build() {
  cd $_name-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd $_name-$pkgver
  python runtests.py
}

package() {
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -vDm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
  install -vDm 644 README.rst -t "$pkgdir/usr/share/doc/$pkgname/"
}
